package com.tongda.core.utils;

public class ProtocolCommand {

	public static final String updateMyInformationAction = "com.tongda.order.message.updateMyInformation";
	public static final String userHasChangedAction = "com.tongda.order.message.userHasChanged";
	public static final String hasMessageUpdatedAction = "com.tongda.order.message.hasMessageUpdated";
	public static final String hasAudioMessageUpdatedAction = "com.tongda.order.message.hasAudioMessageUpdated";
	public static final String hasAudioMessageSttedAction = "com.tongda.order.message.hasAudioMessageStted";
	public static final String hasVedioMessageUpdatedAction = "com.tongda.order.message.hasVedioMessageUpdated";
	public static final String dataReceiveErrorAction = "com.tongda.order.message.dataReceiveError";
	public static final String dataSendErrorAction = "com.tongda.order.message.dataSendError";
	public static final String whoIsAliveAction = "com.tongda.order.message.whoIsAlive";
	public static final String imAliveNow = "com.tongda.order.message.imAliveNow";
	public static final String remoteUserUnAliveAction = "com.tongda.order.message.remoteUserUnAlive";
	public static final String receivedTalkRequestAction = "com.tongda.order.message.receivedTalkRequest";
	public static final String acceptTalkRequestAction = "com.tongda.order.message.acceptTalkRequest";
	public static final String remoteUserClosedTalkAction = "com.tongda.order.message.remoteUserClosedTalk";
	public static final String receivedVedioRequestAction = "com.tongda.order.message.receivedVedioRequest";
	public static final String acceptVedioRequestAction = "com.tongda.order.message.acceptVedioRequest";
	public static final String remoteUserClosedVedioAction = "com.tongda.order.message.remoteUserClosedVedio";

	// system declare
	public static final String bootCompleted = "android.intent.action.BOOT_COMPLETED";
	public static final String WIFIACTION = "android.net.conn.CONNECTIVITY_CHANGE";
	public static final String ETHACTION = "android.intent.action.ETH_STATE";

	// 生成唯一ID码
	public static int getMyId() {
		int id = (int) (Math.random() * 1000000);
		return id;
	}

	public static final int bufferSize = 256;// 缓存区定义，
	public static final int messageLength = 180;// 消息长度为60个汉字，utf-8中定义一个汉字占3个字节，所以消息长度为180bytes
	public static final int readBufferSize = 4096;// 语音文件读写缓存
	public static final byte[] pkgHead = "AND".getBytes();// 网络包头
	public static final int COMMAND80 = 80;// 发送 注册
	public static final int COMMAND81 = 81;// 收到文字信息
	public static final int COMMAND82 = 82;// 视频呼叫做
	public static final int COMMAND83 = 83;// 发送语音
	public static final int COMMAND84 = 84;// 对讲机
	public static final int COMMAND85 = 85;// 云端语音留言
	public static final int COMMAND_TYPE1 = 1;// 发起呼叫
	public static final int COMMAND_TYPE2 = 2;// 响应
	public static final int COMMAND_TYPE3 = 3;// 退出
	public static final int OPR_COMMAND1 = 1;// 被叫应答，请求接受通话
	public static final int OPR_COMMAND2 = 2;// 同意
	public static final int OPR_COMMAND3 = 3;// 拒绝
	public static final int OPR_COMMAND4 = 4;// 网络占线正忙
	public static final int OPR_COMMAND5 = 5;// 请求视频
	public static final int OPR_COMMAND6 = 6;// 同意
	public static final int OPR_COMMAND7 = 7;// 拒绝
	public static final int OPR_COMMAND10 = 10;// 其他
	public static final String MULTICAST_IP = "239.9.9.1";
	public static final int PORT = 5760;
	public static final int AUDIO_PORT = 5761;
	public static final int INTERPHONE_PORT = 5762;

	// int to ip转换
	public static String intToIp(int i) {
		String ip = ((i >> 24) & 0xFF) + "." + ((i >> 16) & 0xFF) + "."
				+ ((i >> 8) & 0xFF) + "." + (i & 0xFF);
		return ip;
	}

}
